<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>项目种类列表</title>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    {CSS href="__ADDONSTATIC__css/font.css" /}
    {CSS href="__ADDONSTATIC__css/xadmin.css" /}
    {js href='__ADDONSTATIC__js/jquery-3.2.1.min.js' /}

    {js href='__ADDONSTATIC__js/xadmin.js' /}
    {js href='__ADDONSTATIC__js/util.js' /}
    {js href='__ADDONSTATIC__lib/layui/layui.js' /}
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-body" id="page">
    <xblock>
        <!--<button class="layui-btn" onclick="x_admin_show('添加','{:addonUrl('Type/addpage')}')"><i class="layui-icon"></i>添加</button> -->
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
           href="javascript:location.replace(location.href.slice(0,location.href.indexOf('mid')+5));" title="刷新">
            <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>分类编号</th>
            <th>分类名称</th>
            <th>阶段名称</th>
        </thead>
        <tbody>
        {volist name='list' id='l'}
        <tr>
            <td>{$l.id}</td>
            <td>{$l.name}   ({$l.parent})</td>
            <td>
                {volist name='l.stages' id='stages'}
                {$stages.name} |
                {/volist}
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
</div>
<script>

    /*用户-删除*/
    function del(id) {
        layer.confirm('确认要删除吗？', function (index) {
            //发异步删除数据
            ajaxUrl('{:addonUrl('Type/delete')}', {id: id}, function (data) {
                console.log(data);
                if (data.code == 1) {
                    layer.msg('已删除!', {icon: 1, time: 1000});
                    location.reload();
                } else {
                    layer.msg(data.message);
                }
            })
        });
    }
</script>
</body>

</html>